package com.human.controller;


import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.human.entity.Empsalary;
import com.human.entity.ResultVo;
import com.human.service.IEmpsalaryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 员工工资 前端控制器
 * </p>
 *
 * @author jzq
 * @since 2023-03-07
 */
@RestController
@RequestMapping("/api/empsalary")
@Api(tags = "薪酬管理")
@ApiSupport(order = 4)
public class EmpsalaryController {

    @Autowired
    IEmpsalaryService empsalaryService;

    @PostMapping("/page")
    @ApiOperation(value = "员工工资分页查询")
    public ResultVo page(int current, int pageSize, String name) {
        return empsalaryService.page(current, pageSize, name);
    }

    @GetMapping("/{id}")
    @ApiOperation(value = "根据ID查询员工工资")
    public ResultVo getEmpSalaryById(@PathVariable("id") Integer id) {
        return empsalaryService.getEmpSalaryById(id);
    }

    @GetMapping("/getAll")
    @ApiOperation(value = "查询所有员工工资")
    public ResultVo getAll() {
        return empsalaryService.getAll();
    }

    @PostMapping("/addEmpsalary")
    @ApiOperation(value = "添加员工工资")
    public ResultVo addEmpsalary(@RequestBody Empsalary empsalary) {
        return empsalaryService.addEmpsalary(empsalary);
    }

    @PutMapping("/updateEmpsalary")
    @ApiOperation(value = "修改员工工资")
    public ResultVo updateEmpsalary(@RequestBody Empsalary empsalary){
        return empsalaryService.updateEmpsalary(empsalary);
    }

    @DeleteMapping("/{id}")
    @ApiOperation(value = "删除员工工资")
    public ResultVo deleteEmpsalaryById(@PathVariable("id") Integer id) {
        return empsalaryService.deleteEmpsalaryById(id);
    }

}

